package com.artisan.common.enums;

/**
 * Created by yang on 2017/6/17.
 */
public enum RoleEnum {
    SUPERADMIN(1,"超级管理员");

    private final Integer value;

    private final String message;

    /**
     * 私有构造函数
     * @param value
     * @param message
     */
    private RoleEnum(Integer value, String message) {
        this.value = value;
        this.message = message;
    }

    public Integer getValue() {
        return value;
    }

    public String getMessage() {
        return message;
    }

    /**
     * 通过枚举<code>value</code>获得枚举
     *
     * @param value
     * @return
     */
    public static RoleEnum getByValue(String value) {
        for (RoleEnum channelType : values()) {
            if (channelType.getValue().toString().equals(value)) {
                return channelType;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return value + "|" + message;
    }

    public static boolean isValidIntegerValue(Integer value) {
        for (RoleEnum channelType : values()) {
            if (channelType.getValue().equals(value)) {
                return true;
            }
        }
        return false;
    }



}
